Add logging to track occasional errors