Fix a bug reported by Patrick Farrell