fix invalid read memory