I think what Les and I are trying say is... you've got issues with the way your current script is, "fixing" it is probably not the right course of action. If you really want to fix it, then I suggest doing as Les's suggested and putting a corresponding endif with all those if's. Another option is to search for Sanity() here on the board. You can run your script through that, and it will help you find errors.