robust fix for linear to avoid negative hess