Add more tests of the models, fix encountered bugs