query set to empty array instead of null to avoid error

setting query equal null throws error later on in function