Fix category detection