Fixed error function.