fixed the function selection