fix crash on odd image resolutions