Added control in case department is null