clean up code before new recording