Merge "Fix ClassCastException in 2nd phase resolution."