retry logic to unwrap exception to check for illegal state

it probably comes wrapped in a remote exception, which we should unwrap in order to detect it..., also, simplified a bit the retry logic

Note, this is against improve_zen branch