Fix a series of bugs: #78, #79, #81, #82

From now on, testing will take quite a while (~2 mins) because of the 30000-ish entries gen_key_sequences creates. We can use: `nosetests -a '!slow'` to skip these.