Fixed some wrong calculations