Fixed some numerical issues in log-det penalty