very nasty bug fix