Fix fileName overwriting; closes #24