test and resolve calculation bugs