 		self.underlineStroke.removeFromSuperview()
 
 		// Get tabCount from dataSource
-
-		if let num = self.dataSource!.numberOfTabs?(self) {
+		
+		if let dataSource = self.dataSource,
+			let num = dataSource.numberOfTabs?(self) {
 			self.tabCount = num
 		} else {
 			self.tabCount = tabControllers.count

	}

	func viewControllerAtIndex(_ index: Int) -> UIViewController? {
		if index >= self.tabCount || index < 0 {
			return nil
		}

		if (self.contents[index] as UIViewController?) == nil {
			var viewController: UIViewController

			if self.dataSource!.responds(to: #selector(PagerDataSource.controllerForTabAtIndex(_: pager:))) {
				viewController = self.dataSource.controllerForTabAtIndex!(index, pager: self)
			} else if self.dataSource!.responds(to: #selector(PagerDataSource.viewForTabAtIndex(_: pager:))) {

				let view: UIView = self.dataSource.viewForTabAtIndex!(index, pager: self)

				// Adjust view's bounds to match the pageView's bounds
				let pageView: UIView = self.view.viewWithTag(34)!

	open var tabsTextColor: UIColor = UIColor.white
	open var selectedTabTextColor = UIColor.white
	open var tabsImageViewContentMode = UIViewContentMode.scaleAspectFit
	open weak var dataSource: PagerDataSource?
	open weak var delegate: PagerDelegate?
	open var tabHeight: CGFloat = 44.0
	open var tabTopOffset: CGFloat = 0.0
	open var tabOffset: CGFloat = 56.0
