check TODOs and fix some bugs