Adding undefined protection