make sure to raise a more sensible error when  not defined