Some fixes for portability across platforms.