Convert the cookie object to its JSON representation before storing, fixes #63

Also a little bit o' spacing.