added NaN test for log_determinant