Fix various regression for building out of tree.