Try to fix possible ClassCastException