Fixed some numerical issues in Q-solving