fixes #2 and CSV errors

CSV had completely busted code, also fixed several race conditions
although I'm sure there are more; added date range in e-mail body.