fixed calculation and display errors