Fixes tests - adds adds null pointer check.