fixed var definitions ... bugs