Fixing some stuff to aid portability.