added the error logging functions