added a couple of missing conditions to the permanent max stops query