Sort into Folder Macro (v11.0.1)

Is there a reason why my macro to sort items in the finder would be sometimes turning folders into, uh, documents? Not quite sure what's going on!

UPDATE: I've worked out that it's happening when I've moved a folder so the file path is wrong. Could some kind soul help me with a "prompt for new file path" if this happens?
This was a folder:

CleanShot 2024-01-18 at 12.05.02

Sort into Folder Macro (v11.0.1)

Sort into Folder.kmmacros (6.4 KB)