fixed som segfaults, but find_gadget is stuck in loop