bug fix in function
bug fix in function