modif to apple.py