fixed update and insert server code