Added check that variable is Object before cloning on it.