Fixed bug: Some exceptions were not caught.