Fixing bug #2

Added code to replace invalid fileName characters.