FWIW, I also ran into this issue and Ethan's patch looks good to me. I just made a slight tweak to remove the impossible lid == NULL check in the subsequent if statement. I attached my patch variation.