Clean up res nil checking