fixed a bug and modified interface