2d calculation works, but the result is wrong