bugfix for numeric issue of image size calculation