Fix #7 and fix #3