Fixed bug in conflicting session ids, fixed a bug in generating cookie string