Fixing edit and delete bug