code causing null check