Cookies: Fix bugs with selectedLectures

Global selectedLectures array was being updated at the wrong time.
Also fixed a bug where the cookies were being initialized to undefined
when starting for the first time.

Fixes #166.