fixed bug with image resizing