bug fixes to get tests to pass