Fixes crash when submitting tree query