Class cast added to remove IDE warning