Fixed potential bug in badness penalty.