Fixed performance issues in visitor