Added unit test and fix a partitioner problem.