Fix delete layer bug