fix #1044
implement #1041