Fixed some math mistakes.