Fix #1120
Propagate changes for #1120 and fix #1121