fix foreach controller