fix bugs in flock