fix the out of boundary

fix boundary