Fixed unit test bugs.