Fixed bugs and edit, delete function