fix #728 and #732