added pickle and corepickle code