Fix for potential key-value observer crash bug.

Change-Id: I91e36f02cd03dcf86b1b37aae0b8f475183ea2a5