fixed a bug, added logs