Sundry fixes and patches