added test for cast index to scalar and if #issue 8)
Merge branch 'contig_local_bug_fix' into fix_issue_8