Fixed some math mistakes