Fix for incorrect calculations