Fix row expanding bug.

Fix row expanding bug where the files were generated twice upon expanding.
Fix bug related to notebook where pages get added and deleted upon selection.