Attempt to modify property "query" on null