Fix #633 and #672