fix #217 and #218