gradient flip-flop workaround

Issue #64