Portability updates

Some portability regressions in master