bug fix: error calculation