added checks for empty course arrays