(parser) fix bug with indexes in neighbor function