Fixed condition to include case where a[k][k] == 0.