some changes to bg_lex