Fixes ClassCastException.