back porting Chris' fix, which is mistakenly removed - patch provided by Dinesh