several fixes and enh