Fixed a few bugs

Fixed a few issues with rename of vars and the use of Ulongs corrupting
further objects.