Fixed the check if script is already running.