adding some logs and synchronize flag + try and catch