Fixed bug: proper state reset between runs