added abs to diagonal check