Fix modify error and add test
Add more unit tests