misc fixes and patches