Added some debug logs and fixed bug by first update