autostart.sh unexpected behavior