Fixed potentionally ClassCastException