got foreach to work properly on object