make sure writing log doesn't cause an error itself