Added better debugging of exceptions