Updated the autostart script so that if an application is already started it is not started twice