fix global leakage
minor bug fix