Improve generate secret token (fix bug)