changing back to malloc, reason given in comment of previous commit