fix lock bugs