add tests, and travis and coveralls - fixes minor bugs