cherry pick #1304 into 1.5-branch