fix cons segmentation fault