fix draw function algorithm a little

fix draw function algorithm a little