Fix compilation errors and various input issues in *nix