Fix a bug and add function