fixed code to remove bug with category