Fixed potential Class Cast Exception