Use the modules table rather than latest_modules
Revised tree_to_json to match on uuid and version