Fix a couple bugs.
Properly update filename.