Reset main and thread variables