refactoring, fixed potential npm dependency bug