fix bug and write TODO