fixing calculations