I am using following code to duplicate layer as it is faster. After duplicating the layer I am trying to create custom selection which is not working for the first time.
Yes you read it right. It will not work for the first time but it will work for the second time.