fix a bug reported by @akurbala