fix ValueError: Cannot use None as a query value