add some check in pil