Fixed a bunch of instantiation-order issues