Memory pool, bug fixes