fix logic error in new write/end overrides.