more bug fixes and changes