minor changes and fix test cases