Auto generated scopes use wrong state column

Hi,
i stumbled over this bug with auto scopes. The commit changes the generated scopes so the correct column name is read from the state machine.