Commenting out background change and setting background
to determine if the problem is with the background or the function.