return empty result rather than segfaulting in weird case
fix bad bug that exaggerated exclusion, add safety, also minor cleanup