make locking more robust

also fix a parameter/method name collision, oops.