fix lock issue in stop()