bug fixes and test files