Two bugs reported by istreeter and wanghc78