Gold gains as dollar dips, but set for worst month since November 2016