fixed null pointer in cp construction