took out if query.length === 0, as it prevented the update