Fixed memory pinning issues