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!