fixed re-initialization of variable