Fix bug of CastException