Fixed memory leak in Image class