amend query to require name not be null