Layers nesting: Fix freezing possibility + fix a few inconsistencies.