Fixes to compatibility with multiple platforms