Fix a ClassCastException

Change-Id: I688e0ea360bdf8dab3f852a2e21dfcfc78bac651