Fix check_scope to work on lists with array scopes

Adds tests for several scenarios. Squashed commits an rebased. Build now passing on 1.8.7