Fixed some flex bugs
Signed-off-by: Rack Lin <racklin@gmail.com>