Memory Issues

Fixed a number of memory issues with registers being confused with local
variables assigning temporary values to local variables.