Thank you @_Ninji and @simonkosua for looking into this and discovering that arbitrarily rearranging code to have exactly the semantic meaning made it start working!
81b645c