Bugfixes and sanitizing of filename.