Wrong drawing algorithm