tweak memory function