fix for reverting PR #148

Reverts PR #148. Also fixes return value.