Fixes to handle certain error cases