Fixing handling of bad_alloc for task_execution_policy