fixed demo to use Memory class