Bug fixes and tests for hw7