Fixed upcasting problems