modified cookie method to preserve backcompat