handle to_yaml of 2.1.0 and below separately