unit test fix, and other minor fixes