Fixed variable overwrite error