more robust logging