fixed REPLACEME bug (copy flatten)