Fixed exception handling. More detail in error messages