improved Gadget class and its __repr__ method

also fixed a bug that occurred when the prefix for
the gadget ended up being encoded in a different way
than the original byte sequence used to find the gadget