fixed a memory problem