Fixed issues with citekey generation and escaping of html characters in BibTex output.
Extended tests.