Fixes to make protocol to class conversion work properly.