Fix argument
Fix error handling
Add a param check of filename empty