Fixed typo, function for error logging