Fix a glaring bug. Update would never have worked.

* wrote tests,
* fixed bug