Fix wrong calculations