bugfix for index queries