Fix #1102, implements #716