fix layer drawing bug