apply Penn's fix d6c9b4790e05e8aca41a8626a82f78a3bad04f45 to issue #111 here