Bug in error calculation fixed