checking for undefined when cloning