fix _tmpfile to allocate mode argument correctly