Port fix of issue #112 to stable branch