added more tests/bug fixes