lots of portability changes (#1405)

No match.