fixed bug in pickling