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