Fixed memory loading and clearing