Some tests and fixes #6