Fixed the generation of a null check before returning a value