Be allocate some arrays correctly. Don't know how they were working before\!