fixes to calculation