Fixed bugs in showLayer