Fixed scope check
Added initial scope tests