fixed compatibility with Pillow