Added fix to allow the filter method sort_by argument to work

This is linked to github issue