Make sure errors will be handled in the correct thread