Fixed bugs in judging.