Several fixes for alternate-PREFIX builds