Added test_selecting_layer. Tested selecting_layer
Fixed bugs in selecting_layer.