Fixed fatal errors in import loop. Still buggy