Fixed error with errors in the logging function