Add a check to avoid an NPE