Fix exception handling and prittify printouts