Fixed some calculating mistakes