cleanup random gates