Bug fix.

Array_search was not behaving because I had forgotten that it returns
the array index when a match is found, not 1/0 for true/false. This
should resolve the resulting misbehaviour.