moved out from seneca, fixed save merge bug