Fix bug causing js models to be out of sync with database