fixed a bug may cause ClassCastException