fixed issue in cookie function for back-compatibility