fixed bug when the user specifies both ID and score in the results list

When both ID and includeScore options are specified, the result was undefined due to a bug in constructing the results list at the end of the function. This is fixed now.