fixed infinite loop bug

also updated todo