Merged fix from the 4.1-dev branch for TRQ-1786.