better image handling on resizing