fixed a bug in the function feature