refactor ng + fix in history