fixed locking isssue.