Fixed STATA export: No output when debug!=0

DEV: Menno, both reported issues should be fixed with this commit.
DEV: Thanks for the close look!
Merge pull request #105 from mfaber/updatestataexport

DEV: Fixed STATA export: No output when debug!=0