fix some portability problems (by pavel).
4 files changed