bug fixes and rebuild