CDAP-895 - Copy CDAP-641 fixes to release/2.5.0

This simply backports a fix from `develop` to `release/2.5.0` to resolve [CDAP-895](https://issues.cask.co/browse/CDAP-895)