some bug fixes and design changes