fixed mem functions