Corrected typo in error function