Fix for acceptance test failure

I tried to cherry-pick the fix from master but there were too many conflicts.
So I just back ported the fix.