Apoc.refactor.categorize creates duplicated category nodes

Hello,
I've been using apoc.refactor.categorize on Neo 3.5.6 and then Neo 3.5.12 on Windows and I'm getting inconsistent behavior with duplicated category nodes created. And sometimes I also get the below error message when running the procedure:

Neo.ClientError.Procedure.ProcedureCallFailed

Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.refactor.categorize: Caused by: org.neo4j.kernel.DeadlockDetectedException: ForsetiClient[0] can't acquire ExclusiveLock{owner=ForsetiClient[8]} on NODE(4041), because holders of that lock are waiting for ForsetiClient[0]. Wait list:ExclusiveLock[ Client[8] waits for [0]]

Attached a screenshot of the results I'm getting with in grey the category nodes duplicated and in orange the original nodes some of them having a relationship to each duplicated and some not.

Hello! Yes, thanks for bubbling this up. We actually have a pull request open on the Github repository right to fix this issue (https://github.com/neo4j-contrib/neo4j-apoc-procedures/pull/1348). We hope to have it in the next release, which should be in about a week or two.

In short, this should be resolved soon! Let us know if you need anything else!

Cheers,
Jennifer