Thank you for the reply rainbirdb.
When I turn it on from cold, the rpm are very irregular. After being hot it gets better. It keeps working unless I accelerate and cut the gas in a fast movement. In that case, when the revs come down the engine goes down. The bike is easy to start and it goes well all over the rev range. The problem is this down low rpm, that even increasing the idle to 1500 does not solve the problem. The mechanic told me that already checked the vacuum line but I will check that again.