fix global memory leak of 'controller'