[Bugfix] Use temp variable to avoid overwriting