fixed var overlapping in init function