Sync bunch of minor changes with v1.65-real