Added more tests, fixed bug in scope enumeration