Better error logging to find bug that was not there