bugfixes and lexer improvements