Finish up sandbox dependency loading

This can be improved still but at least it should not give any errors now.
Previously it could generate those if the dependencies happened to be loaded in
the wrong order (depended on luck).