cookie support

added cookie support and fix for repeated queries