added positive definite check