Try adding it to a struct maybe? Either that, or check to see if the variables have been mentioned properly. It looks like as if the error is based on an undefined variable.
Hope that helps you.