add tests for isIP and fix some bugs