fix issue #896,#647

fix issue #896,#647