fix issue for drawing rectangle