Gold gains as risk aversion weighs on dollar