bug fixes; test fixes