implement runtime type checking in unsafeCopy to support renaming
restore pretty printers