Add basic tests and fix errors