fix #156 and #183