added edit and update function(error in update)