wrong fix was applied to #331, variable was overwritten

this is the actual fix