Adding test for health check.

And fixing associated bugs.