sort of fix some dodgy javascript search bugs