more error checking in update