adding a check
scripted update of code from master at 3a0f5f9 adding a check