add serialize and correct getSecret bug