Move graphic control to graphics.c and fix some bugs