Added patch to try and avoid race condition when generating image styles