improve visitor, extend test, some bugfixing