Trestle fixes (rebased onto develop)



This is the same as gh-398 but rebased onto develop.

----

Fixes ticket #10356 and allows us to use the internal pyramid in Trestle files.