Fixed memory problem