fix #121 and #127