Fixed a bug in cons that caused a dangling pointer