handle possible Nonetype usage, fixes #150.