added category test and fixed query