add config paramater and bug fix