2 more bug fixes and optimization for line drawing