db query isn't working in rules