Fixes for Unix. (thanks to Philippe Joyez)