fixed bugs, added unit tests