Add in new lock checks.

The second of the new lock checks on lines 252 and 253 are not strictly necessary, but they prevent nefarious evil-doers from bypassing locks by calling LockImpl() via reflection.