Make synchronization work kinda predictably.

References #4.
Keep habitTaskMap up-to-date properly.

This is needed to avoid unnecessary calls to RTM.