Fixes model tests

Also fixes #202.

This pull request should fix all tests.