Fix IllegalArgumentException when scope is a String instead of a collection

Fixs gh-266