fixed a bug about reading cookie