Fixed several instance scope errors.
Merge pull request #1 from dilvie/fix-state-bugs

Fixed several instance scope errors.