clean up a part of gather routine