Add try condition during pickling