Fixes #28 to make saving plans more robust.