tests and minor fixes