fixed the problem of swap to correct category when type text.