added validation to update()