this else condition fails when reached. change this allow the append to occur.
re: Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': The new child element contains the parent.