Fixed a bug where filename was not replacing spaces with underscores.