several fixes and changes