pickle error fixed, done some decoupling