Fixed new and edit bug