fixed bug that was overwriting variables