Fixes bug that only the last item in search criteria is used

Part of OOIION-1538
Merge pull request #111 from Bobfrat/ooiion1538_rel2

Fixes bug that only the last item in search criteria is used