Better fix for issue #158