Fixed draw_tex function