Fix issue #703 and #704