attempt at tidying up graphics memory seems to be catching something