Fix bug with tempfiles

Fix #16. I'm in a mood today :)