fixes to math operations