more tests and minor fixes