error in query in assign_resources