Fix total count
metadata was observing the wrong cursor
also do some cleanup in the onStop callback