Fix to pickling