Fixed Bugs in Value Calculation