improved file arguments validation