fix layer creation