multiple fixes and improvings