updated error logging