1. fix main controller memory leak