Fixed bug in ResultMatch and switch for choosing the index type