fixed some redundant calculations in graphics