fix data races in controller

Fix #305
This is good point. I am changing to WaitGroup now.