adapt to isFileNameValid, whitespace cleanup