add debug log
handle cookie