fixed all php errors. Import loop still broken.