updated pickle code