fixed the bug reported by Brian