CAL-801 port fixed PR from 4.0.x
Merge commit 'b373dd8ede336e23cac7809b96f705520c08e1e8' into HEAD