fixed calculation error