fixed var declaration
implemented some more "mutexes"