fix count problem in controller