Fixed to check if value returned is nil