Fixed issue #2930 about calling multiple times begin()