Memory corruption fixed