Fix for infinite loop bug on small scaled background images.