category controller's code fixed to better coding