Make sure assignment does not leave host with wrong state on exception

cc @ares