Various fixes to improve portability
Various fixes to improve portability


Former-commit-id: 7d63708c7a80f93299d751c85108cde460cc8e13 [formerly 7d63708c7a80f93299d751c85108cde460cc8e13 [formerly 02a994f3b7b875d79008197ef3c5f9047e028281]]
Former-commit-id: 0f2cfc91ed520c3911ff8927db8b158f2aa0a127
Former-commit-id: 0a8f74d17f44f4a6c32340c8fe1c9134a1ac3566
gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine