util.rewriteids: added tests