Fix broken topic recounting on unpublished topics

May fix longstanding bug #1367 at least the bug description fits to the issue I fixed.
$result is an array or null, so it does work indeed. Just not sure if it fixes the whole issue.