fix input variable scope