fix the function