port fixes from the release/3.1.0 alpha branch