fix layer clearing