fixed PIL import and auto generate simulation