Improve unit tests, fix some bugs
Add unit tests for range & repeated