fix too many soql queries