cleanup for .write redirect functions