fix bug when editing layer