fixed mem problem