Fixed bugs in save/restore layout code and split nodes