Fixed diagonal badness checking.