Attached 2 - the relevant part of our patch (in frame.c)