cons function - segmentation fault to check