Basically I have a structure that used to work perfectly in 3.0.x and now it breaks with undefined variable errors.
undefined variable
I think I had the same problem and what helped was declaring the variables before @imports. Hope this helps someone =).