Add system test

System test environment and related system test
Fixed some minor bug
xrange