adding some pickling exception handling