fixes a wrong select for scopes if the state machines attribute_name is set