The project directory was being reconstructed multiple times instead of using the project_dir function.