Fix #1210 and implement #1212