Fixup references
Attempt to fix tests
Fixed ifdefs