bug fix memory access