made the upstart script more robust