Made image resizing work a little better