fix #1214 and #1215