Fix carefulwrite and its usage within manager (bug #5355, maybe)