fix visitor bugs, need further check