Fix #161 and Fix #176