Fixed memory_pool implementation