multiple fixes and improvs