fixed reentrant issue