Moved begin() since the lock() function may cause a BEGIN.