fix #172 and #173