bug fixes and testing