Fix bug causing reference to previous models being overwritten