Prevented continueous copying of dlls.
Added checks to all the mallocs