Fix some conditions for unit testing. bugid:111411