Fix #196 #207

test code added and passed