Fixed invalid memory lock contents.
I hope this method is the final implementation of memory locking.