null check to fix junit test