a gentler fix which provides a warning instead of a random nil error.
fix for #332