Minor patches from Adam Bishop to fix build issues from commit 1bc4bf5.