fix bug and add ajax