fixed bug for demo and adding cookie