more cross-platform compatibility fixes