If you aren't changing the value of the FUNCTION, then the video driver is probably confused. Change CASE to whatever each time...