Added some more robust logging.