Fixed the exception being caught