bug fix from #2247