Apply hotfixes and improvments from develop to fix failing jenkins tests.

This PR integrates all the upstream improvements we have made in develop for 2.0.2 release.