more logging and variable initialization when errors are logged.