removed logs, fixed error on first iteration