Implement search.maxhits
fix crash in rop search

fix crash where rop.len is either huge or 0