some refactoring for erpclient.