optimizations and fixes (origin related) for drawing