ClassCastException issue fixed

This issue reported by TCMB project in 0.4.x branch