Following C# implementation, we should marshal Scopes as a set of strings instead of single byte.
part of #1036
closes #864