fixed a bug that did not reset the function selector