* fix foreach bugs