fix a invalid memory read