Fixed bug in js used to find duplicate categories