fixing popups and nesting of layers