locking patch by James M. Lawrence