merge the modify from karellm

merge the modify from karellm, add test coverage