some fixes in image.php