Allow the terminal value to be null or undefined

See test cases.

CC: @calvinfo @lancejpollard @ianstormtaylor