Fixed download image issue and corrected drawing grid function