Fix param variable scope