Merge pull request #1228 from jamezp/main-ports

fast track: Port missed fixes that were in release-4.0