check for nulls
more useful error message