Fix. check memory allocation
Update example