fixed update and delete functions