clean up ugly category detection