I have fixed the sitemap/organizational chart issue by creating an unending loop until no data is fetched. This ensures that the chart will display until the deepest level of data is reached. However, in order to prevent the system from crashing, I have added a safety measure to check for coding errors. If any errors are detected, the loop will be stopped and the data will be re-encoded before being processed again. This ensures that the system will not crash due to an unending loop.