Fixed bug in current_state_to_object()

When the object passed current_state_to_object() was already bound in a hierarchy, the function failed. This was fixed, by creating a clone of the object.