fixed portability issues