fix scoping issues in NanAsyncPersistent