added valid query in model