fixing mismemory