fix issue #77 and issue #78