Adjusted support for max results and a bug fix.

SD-64 : make it work with new api

Adjusted support for max results and a bug fix.