refactoring and fix stripe bug