Fix bug reported by A. J. Parker