Fix Layer->region to use correct variable.