added option to make nil values an exception