fixed invalid memory access