This logic was intended to mirror what is done for "write", but the wrong variable name was repeated twice.