Fix imports, rename state_name in state for plugin model