Linux compatibility fixes

I think I've fixed most of the stuff that was broken on linux