Misc fixes to tests and makefiles
Merge review 470 by @wmrowan