Fix dispose call throwing exception if called during setup
Merge pull request #366 from RomanZhilich/fix_dispose_during_setup

Fix dispose call throwing exception if called during setup