Fix foreach to work only with keys