Improved stub-generate script: modified location generation