Solved bad memory access