Fix implementation of "keep aspect ratio" for background images.