added check for PIL