Added lock for leaving flaf