fixes to maths