several fixes and additions