Added more robust error messages.