fixed some bugs
adding trace logs