FIX variable scope