fix a bug and clean unused files