test fixes and bug fixes