Make converting work for reference types. [rev: aaron]