bug fix for sort by resource field