Fixed few bugs while unit testing.