more fixes for malloc, gotta test it better still :)