Proper workaround

The code is still wrong but at least it is not executed when tx log is disabled (as it should be).