Fixed incorrect calculations

Fixed incorrect calculations