fixed reference to use byCriteria and bySort