fixes for portability issues