added logly, fixed some bugs