FIx #226: selection survives a store notification.

Fixed some bugs and and created a test page.