replace ended state with underscore.once