fixed bug reported by @fred