fix cons function bug