Fixed a few bugs in the observer, discovered from local testing.