Fix gradient. Credit to UBER.