Allow setting the filename in STF_DEBUG env var
fix STF_DEBUG handling
Add more tests