add file existence check
fix filename empty error message
add file name normalization