fix #1216 and #1215