Fixes for out-of-tree build and test