Model bugfixes and improvements.