Fixed a bug in update that replaced the whole document on $set