better nil checking