backport of smb fixes