Fix #1092 and Fix #979