Fix CommandRegistry::get/restoreSnapshot

I didn’t realize that deepClone was not handling functions correctly.
I’ve implemented clone manually to the exact depth needed instead.
Break command dispatch as soon as currentTarget is null