graphics state check added

now checks if a graphics function is called outside a graphics loopback