fix #27 and #19