check for null
fixes #40