Fixed handling of longs, and turned class/instance references into global references.