fix #80 and #124