fixed many small bugs, added unit test for dto