fix a math error in background image generation