Added some exception catching for debugging