0 is False in Python, so passing start=0, num=20 to sort will return all the results. Line 676: if start and num Should be: if start != None and num != None: