resolve portability issues (to BSD and Win x64)