Not able to use csssector with safari with RemoteWebdriver

I am trying to run Remotewebdriver on iPhone and it is working fine with Xpath and ID. But, getting following error with css selector : “org.openqa.selenium.WebDriverException: Returned value cannot be converted to WebElement: a[data-index=‘0’]”

I am using following config:
Appium: 1.8.0
Java: 1.9
java-client 5.0.3
MAc: High Siera
Simulator: 10.3

update the sample code here.

It worked. Appium 1.8 does not support CSSSelector. I downgraded to 1.7.1