Hmm. It appears that some of those variables aren't available if those checkboxes are turned off. To fix that, just leave all the checkboxes on, and remove ALL this code from the above template. There's probably a way to make the values available even when the checkboxes are off, but I haven't looked into it.
Content visible to verified customers only.