Bug Fix: Avoid ClassCastException.