fix moe bug of omitting the return value of malloc