Bugfix: SQL search query was loglically wrong