added check to avoid running the script twice