make it more safe, for issue #12