only check diagonal when necessary