fix several bugs and remove a useless file