Tweaks for getting tests running
Merging master changes into upgrade branch.