Fix issue #164 (#165, #166)