Fix #94 and fix #169