failing more gracefully if input data is screwed up