fix #222 and #223