I tried, and it works, but it disables the smooth/nice animation when resizing the window.
In place, the images from the grid go weirdly to bottom/right when resizing.
It’s not that serious, so for the time being I put this, in order to apply your code only on retina screens:
I made the change only for retina because I’ve not this bug on normal screens, even on a dual screen (more than 3400 pixels of width).
With your patch, which makes thankfully the 4 columns working on a retina screen (anyway for Microsoft Surface), it makes strange movements on the images from the grid when resizing manually the window. But the important thing is that the 4 columns layout is now working.
However, there is no problem when choosing a 3 or 5 columns layout.