fix incorrect comparison loop condition in memmem