compatible with old code
optimize pure python path