Linux support fixes

Also has the commits in #3 so that one should be merged first.