Add lib tests and fix models test