I think you also need to check for NO_TRANSACTION here, in case the transaction has already been rolled back and disasociated. This should not happen if everyone is being spec compliant, but I think it may happen in the real world.