fixed some calculation error