Speculative fix for transaction crash. Check if there is a transaction before proceeding.