Checks if returned value is null, then returns undefined. Also specs for this functionality