Fixed bug where we tested for wrong exception