Small fixes to get working on Ubuntu

Cherry-pick 6f307d8 through d981be0 from #2.