better log handling