Bug fixes, add external functions to core.memory