fix portability problems