Amend CRM-12995 fix

The regression introduced in 8bab0eb08b9862b49b02e914321bd15c0aca487e
(mismerge of patch for http://issues.civicrm.org/jira/browse/CRM-12172 )
was fixed in 14c8cdaa39005e0752e8beca670faa470b2147ce only partially.

This commit adds the rest of the necessary fix to fully undo the
original regression.

(Note: I have not really tested the effect of the amended fix, as I
don't know in what situations it shows -- I only discovered this in the
code while looking for another regression... It's a pretty obvious
change though.)
Merge pull request #1238 from sfe-ev/CRM-12995_amend

Amend CRM-12995 fix