fixed service variable scope problem