bugfix with index