Sandbox can't be disabled if a sandbox bank transaction has been deleted

We've detected an issue in our backend when a user in sandbox mode tries to switch to real data after having deleting a sandbox bank transaction. This issue triggers a server error with a HTTP response code 500.