Fixed model bugs

Fixed a few bugs causing creates and updates to ocasionally fail.