Minor tweak to make error logging more robust