Fix bug for chrome and refactoring