More exception handling and small fixes