fix the internal state names and provide a hook for plugins