fix fence bug