changed pattern match on pickle, fixed r