add some unit tests, fix some bugs, add travis ci file