Checking a few returned values to avoid returning null.