Added logging to debug a crash